package com.devin.exception;

import org.springframework.http.HttpStatus;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import javax.validation.constraints.NotNull;

/**
 * @author: simpl
 * @date: 2020/3/19
 * @time: 10:51
 * @description: 
 */
public abstract class BaseException extends RuntimeException{


    //错误的数据
    private Object errorData;

    public BaseException(String message) {
        super(message);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    @NonNull
    public abstract HttpStatus getStatus();

    @Nullable
    public Object getErrorData() {
        return errorData;
    }

    @NotNull
    public BaseException setErrorData(@Nullable Object errorData){
        this.errorData = errorData;
        return this;
    }

}
